import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { View, Text, Image, StyleSheet } from 'react-native'
import { Button, Result, Icon } from 'antd-mobile'
import color from '../libs/color'
const successIcon = require('../img/Normal/success.jpg')

export default class extends PureComponent {
  static propTypes = {
    onEnter: PropTypes.func,
    message: PropTypes.string,
  }

  static navigationOptions = ({ navigation }) => ({
    title: "",
    headerTintColor: 'white',
    headerStyle:{ backgroundColor: color.theme},
  })

  render() {
    const { onEnter, message } = this.props
    const msg = message || "提交成功"
    return (
      <View style={styles.tip}>
        <Result
          img={<Image source={successIcon} style={styles.tipImg}/>}
          message={msg}
        />
        <Button onClick={onEnter}>确认</Button>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  tip: {
    backgroundColor: 'white',
    height: 250,
    alignItems: 'center',
    justifyContent: 'center'
  },
  tipImg: {
    height: 40,
    width: 40
  },
  tipText: {
    fontSize: 17,
    color: '#333333'
  }
})
